<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div,p{
            width: 100px;
            height: 100px;
            background-color: red;
            margin: 20px;
        }
        div#bottom{
            width: 200px;
            height: 200px;
            background-color: blue;
        }
    </style>
    <script>
        window.onload=function(){
           var top=document.getElementById('top');
           var bottom=document.getElementById('bottom');
           top.ondragstart=function(event){
               var data=event.dataTransfer;
               data.setData('id',this.id);
           }
           bottom.ondragover=function(event){
               event.preventDefault();
           }
           bottom.ondrop=function(event){
            var data=event.dataTransfer;
            var id=data.getData('id');
            var top=document.getElementById(id);
            this.parentNode.replaceChild(this,top);
            this.parentNode.appendChild(top);
           }
        }
    </script>
</head>
<body>
   <div id="top" draggable="true"></div>
   <div id="bottom"></div>
</body>
</html>